import React from 'react'
import useScroll from '@/hooks/useScroll'

export default function App() {
  const [x,y]=useScroll()
  console.log('x',x);
  console.log('y',y);
  return (
    <div
      style={{height:'1000vh',width:'1000vw'}}>
        {
          y>2000&&<div style={{
            width:'100px',
            height:'50px',
            backgroundColor:'orange',
            position:'fixed',
            top:'10px',
            right:'10px'
          }} onClick={()=>{
            document.documentElement.scrollTop=0
          }}>返回顶部</div>
        }
    </div>
  )
}
